﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript">
        //-------------------------------------------------------------------------
        // Demo 1
        //-------------------------------------------------------------------------
        var person = (function () {
            var fieldName = '<name>';
            var fieldCode = '<code>';

            return {
                getCode: function () {
                    return fieldCode;
                },
                getName: function () {
                    return fieldName;
                },
                getInfo: function () {
                    return 'Fullname: ' + fieldCode + ' ' + fieldName;
                }
            };
        })();

        console.log('Person Information');
        console.log(person, person.getCode(), person.getName());

        //-------------------------------------------------------------------------
        // Demo 2
        //-------------------------------------------------------------------------
        function Person(code, name) {
            this.Code = code;
            this.Name = name;
            this.Favorites = [];
            this.National = '<-->';
        }
        Person.prototype = {
            constructor: Person,
            getCode: function () {
                return this.Code;
            },
            getName: function () {
                return this.Name;
            }
        };

        var p = new Person('B', 'Bill');
        console.log('Demo 2');
        console.log(p.getCode() + ' ' + p.getName() + ' ' + p.Code);
    </script>
</head>
<body>
</body>
</html>
